export default {
  namespaced: true,
  state: {
    loginStatus: false,
    callNumber: "",
    callId: "",
    fileName: "",
    isHangUp: false,
    currentStatus: '',
    eventData: {},
    cPhoneStatus: 'online',
    awayStatusList: [],
    isShowModal:false,
    multiChannelLogout: () => { },
  },
  mutations: {
    updateLogin (state, status: boolean) {
      console.log('status', status);
      state.loginStatus = status;
    },
    updateCallNumber (state, callNum: string) {
      state.callNumber = callNum;
    },
    updateCallId (state, callId: string) {
      state.callId = callId;
    },
    updateCallFileName (state, fileName: string) {
      state.fileName = fileName;
    },
    updateIsHangUp (state, flag) {
      state.isHangUp = flag;
    },
    updateCurrentStatus (state, status: string) {
      console.log('status', status);
      state.currentStatus = status
    },
    updateEventData (state, data) {
      console.log('eventData', data);
      state.eventData = { ...state.eventData, ...data }
    },
    updateCPhoneStatus (state, data) {
      state.cPhoneStatus = data
    },
    setMultiChannelLogout (state, fun) {
      state.multiChannelLogout = fun
    },
    setAwayStatusList (state, data) {
      state.awayStatusList = data
    },
    setIsShowModal(state,data){
      state.isShowModal = data
    }
  },
  actions: {
    reSet ({ commit }) {
      commit("updateLogin", false);
      commit("updateCallNumber", "");
      commit("updateCallId", "");
      commit("updateCallFileName", "");
      commit("updateIsHangUp", false);
    },
    finished ({ commit }) {
      commit("updateCallNumber", "");
      // commit("updateCallId", "");
      commit("updateCallFileName", "");
    }
  }
};
